import java.awt.BorderLayout;
import java.awt.FlowLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextField;


public class Felulet extends JFrame{

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	private JButton bt;
	private JPanel pn,pn_paint;
	private MyCanvas canvas;
	Felulet()
	{
		setLayout(new BorderLayout());
		pn = new JPanel();
		pn_paint = new JPanel();
		pn.setLayout(new FlowLayout());
		final JTextField tf[] = new JTextField[6];
		JLabel lb[] = new JLabel[6];
		bt = new JButton("Indit");
		canvas = new MyCanvas(0);
		
		lb[1] = new JLabel();
		lb[2] = new JLabel();
		lb[3] = new JLabel();
		lb[4] = new JLabel();
		lb[5] = new JLabel();
		tf[1] = new JTextField("6",10);
		tf[2] = new JTextField("2",10);
		tf[3] = new JTextField("0",10);
		tf[4] = new JTextField("3",10);
		tf[5] = new JTextField("1",10);
		
		
		lb[1].setText("N:");
		lb[2].setText("R:");
		lb[3].setText("S:");
		lb[4].setText("T:");
		lb[5].setText("P:");
		
		pn.add(lb[1]);
		pn.add(tf[1]);
		pn.add(lb[2]);
		pn.add(tf[2]);
		pn.add(lb[3]);
		pn.add(tf[3]);
		pn.add(lb[4]);
		pn.add(tf[4]);
		pn.add(lb[5]);
		pn.add(tf[5]);
		pn.add(bt);
		pn_paint.add(canvas);
		this.getContentPane().add(pn, BorderLayout.NORTH);
		this.getContentPane().add(pn_paint, BorderLayout.CENTER);
		
		bt.addActionListener(new ActionListener() {
			
			private Szimulacio sz;

			@Override
			public void actionPerformed(ActionEvent arg0) {
				this.sz = new Szimulacio(Integer.parseInt(tf[1].getText()),Integer.parseInt(tf[2].getText()),Integer.parseInt(tf[3].getText()),Integer.parseInt(tf[4].getText()),Integer.parseInt(tf[5].getText()),canvas);
				canvas.setSzimulacio(this.sz);
				canvas.setElinditva(1);
				sz.start();
			}
		});
	}

}
